***Oceno & Yen, "The Impact of Racial Descriptive Norms on Vaccination against COVID-19"***


*Race

gen race=.
replace race=1 if q3=="1" 
replace race=2 if q3=="2"
label define race 1 "White" 2 "Black"
label values race race

*Party ID

gen partyid=.
replace partyid=1 if q25==1 & q27==1
replace partyid=.833 if q25==1 & q27==2
replace partyid=.667 if q25==3 & q28==2 | q25==4 & q28==2
replace partyid=.5 if q25==3 & q28==3 | q25==4 & q28==3
replace partyid=.333 if q25==3 & q28==1 | q25==4 & q28==1
replace partyid=.167 if q25==2 & q26==2
replace partyid=0 if q25==2 & q26==1
label variable partyid "Party ID, Strong Dem=1"

gen partyID_rep=.
replace partyID_rep=0 if partyid>=.5&partyid<=1
replace partyID_rep=1 if partyid<.5&partyid>=0

gen partyID_dem=.
replace partyID_dem=0 if partyid<=.5&partyid>=0
replace partyID_dem=1 if partyid>.5&partyid<=1

*Gender

gen gender=.
replace gender=0 if q2==1
replace gender=1 if q2==2
label define gender 0 "male" 1 "female"
label values gender gender
label variable gender "Gender"

*Children

gen kidsunder18=.
replace kidsunder18=(q38-1)/9 if q38>=0

*Age

gen ageN=.
replace ageN=(q1+16)/100 if q1>1 & q1<8
replace ageN=(q1+17)/100 if q1>=8

*Rural ID

gen rural=.
replace rural=1 if q29==3
replace rural=.5 if q29==2
replace rural=0 if q29==1

gen ruralID=.
replace ruralID=1 if rural==1
replace ruralID=0 if rural!=1

gen urbanID=.
replace urbanID=1 if rural==0
replace urbanID=0 if rural!=0

*Essential worker

gen essential=.
replace essential=0 if q31==2
replace essential=1 if q31==1 

*Education

gen education=.
replace education=. 
replace education=(q42-1)/6 if q42>0

gen educ1=.
replace educ1=1 if q42==1
replace educ1=0 if q42!=1 & q42>0

gen educ2=.
replace educ2=1 if q42==2
replace educ2=0 if q42!=2 & q42>0

gen educ3=.
replace educ3=1 if q42==3
replace educ3=0 if q42!=3 & q42>0

gen educ4=.
replace educ4=1 if q42==4
replace educ4=0 if q42!=4 & q42>0

gen educ5=.
replace educ5=1 if q42==5
replace educ5=0 if q42!=5 & q42>0

gen educ6=.
replace educ6=1 if q42==6
replace educ6=0 if q42!=6 & q42>0

gen educ7=.
replace educ7=1 if q42==7
replace educ7=0 if q42!=7 & q42>0

*Income

gen income=.
replace income=(v58-1)/11 if v58>0

gen income1=.
replace income1=1 if v58==1
replace income1=0 if v58!=1 & v58>0

gen income2=.
replace income2=1 if v58==2
replace income2=0 if v58!=2 & v58>0

gen income3=.
replace income3=1 if v58==3
replace income3=0 if v58!=3 & v58>0

gen income4=.
replace income4=1 if v58==4
replace income4=0 if v58!=4 & v58>0

gen income5=.
replace income5=1 if v58==5
replace income5=0 if v58!=5 & v58>0

gen income6=.
replace income6=1 if v58==6
replace income6=0 if v58!=6 & v58>0

gen income7=.
replace income7=1 if v58==7
replace income7=0 if v58!=7 & v58>0

gen income8=.
replace income8=1 if v58==8
replace income8=0 if v58!=8 & v58>0

gen income9=.
replace income9=1 if v58==9
replace income9=0 if v58!=9 & v58>0

gen income10=.
replace income10=1 if v58==10
replace income10=0 if v58!=10 & v58>0

gen income11=.
replace income11=1 if v58==11
replace income11=0 if v58!=11 & v58>0

gen income12=.
replace income12=1 if v58==12
replace income12=0 if v58!=12 & v58>0

egen incomeavg=mean(income)

gen income_norm=.
replace income_norm=income/incomeavg
label variable income_norm "Normalized income - individual / average income in year"

gen income_norm01=.
replace income_norm01=income_norm/2.485723 

*Evangelical Christianity

gen evangelic=.
replace evangelic=1 if q40==2
replace evangelic=0 if q40!=2 & q40>0


**********EXPERIMENTAL CONDITIONS***************

gen condition1=.
replace condition1=1 if fl_17_do=="ExperimentControl"
replace condition1=0 if fl_17_do!="ExperimentControl"

gen condition2=.
replace condition2=1 if fl_17_do=="FL_35"
replace condition2=0 if fl_17_do!="FL_35"

gen condition3=.
replace condition3=1 if fl_17_do=="ExperimentTreatment2(H,L)"
replace condition3=0 if fl_17_do!="ExperimentTreatment2(H,L)"

gen condition4=.
replace condition4=1 if fl_17_do=="ExperimentTreatment3(L,H)"
replace condition4=0 if fl_17_do!="ExperimentTreatment3(L,H)"

gen condition=.
replace condition=1 if condition1==1
replace condition=2 if condition2==1
replace condition=3 if condition3==1
replace condition=4 if condition4==1
label define condition 1 "Control" 2 "T1" 3 "T2" 4 "T3"
label values condition condition

label var condition1 "Control"
label var condition2 "T1"
label var condition3 "T2"
label var condition4 "T3"

*Trust in the scientific method

gen sciencetrust=.
replace sciencetrust=0 if q21==2
replace sciencetrust=1 if q21==1


**************OUTCOMES*****************

*Likelihood of vaccination asap

gen vaccineasap=.
replace vaccineasap=1 if q15==8
replace vaccineasap=.75 if q15==9
replace vaccineasap=.5 if q15==10
replace vaccineasap=.25 if q15==11
replace vaccineasap=0 if q15==12

*Likelihood of vaccination after a while

gen vaccinelater=.
replace vaccinelater=1 if q16==1
replace vaccinelater=.75 if q16==2
replace vaccinelater=.5 if q16==3
replace vaccinelater=.25 if q16==4
replace vaccinelater=0 if q16==5

alpha vaccineasap vaccinelater, gen(vaccine)

*Multiple doses

gen multipledose=.
replace multipledose=1 if q17_1==1 & q17_do=="1|2|3" | q17_3==1 & q17_do=="3|2|1"
replace multipledose=.5 if q17_1==2 & q17_do=="1|2|3" | q17_3==2 & q17_do=="3|2|1"
replace multipledose=0 if q17_1==3 & q17_do=="1|2|3" | q17_3==3 & q17_do=="3|2|1"
replace multipledose=-.5 if q17_1==4 & q17_do=="1|2|3" | q17_3==4 & q17_do=="3|2|1"
replace multipledose=-1 if q17_1==5 & q17_do=="1|2|3" | q17_3==5 & q17_do=="3|2|1"

*Annual booster

gen everyyear=.
replace everyyear=1 if q17_2==1
replace everyyear=.5 if q17_2==2
replace everyyear=0 if q17_2==3
replace everyyear=-.5 if q17_2==4
replace everyyear=-1 if q17_2==5

alpha multipledose everyyear, gen(repeatedvax)

*Choice among brands

gen vaccinechoice=.
replace vaccinechoice=1 if q17_3==1 & q17_do=="1|2|3" | q17_1==1 & q17_do=="3|2|1"
replace vaccinechoice=.5 if q17_3==2 & q17_do=="1|2|3" | q17_1==2 & q17_do=="3|2|1"
replace vaccinechoice=0 if q17_3==3 & q17_do=="1|2|3" | q17_1==3 & q17_do=="3|2|1"
replace vaccinechoice=-.5 if q17_3==4 & q17_do=="1|2|3" | q17_1==4 & q17_do=="3|2|1"
replace vaccinechoice=-1 if q17_3==5 & q17_do=="1|2|3" | q17_1==5 & q17_do=="3|2|1"


***********************FIGURES****************************


***FIGURE 1***

reg vaccine i.condition#i.sciencetrust if race==2
margins condition#sciencetrust
marginsplot, by(sciencetrust) scheme(plotplain) recast(scatter) level(84) plotopts(mlabel(_margin) mlabformat(%9.2f) msymbol(D) msize(small) mlabposition(2)) ytitle("Vaccination Intent") xtitle("Condition") name(vaccine_bl)

reg vaccine i.condition#i.sciencetrust if race==1
margins condition#sciencetrust
marginsplot, by(sciencetrust) scheme(plotplain)  recast(scatter) level(84) plotopts(mlabel(_margin) mlabformat(%9.2f) msymbol(D) msize(small) mlabposition(2)) ytitle("Vaccination Intent") xtitle("Condition") name(vaccine_wh)

graph combine vaccine_bl vaccine_wh, row(2)


***FIGURE 2***

reg repeatedvax i.condition#i.sciencetrust if race==2
margins condition#sciencetrust 
marginsplot, by(sciencetrust) scheme(plotplain)  recast(scatter) level(84) plotopts(mlabel(_margin) mlabformat(%9.2f) msymbol(D) msize(small) mlabposition(2)) ytitle("Vaccination Intent Decrease/Increase") xtitle("Condition") name(repeatedvax_bl)

reg repeatedvax i.condition#i.sciencetrust if race==1
margins condition#sciencetrust 
marginsplot, by(sciencetrust) scheme(plotplain)  recast(scatter) level(84) plotopts(mlabel(_margin) mlabformat(%9.2f) msymbol(D) msize(small) mlabposition(2)) ytitle("Vaccination Intent Decrease/Increase") xtitle("Condition") name(repeatedvax_wh)

graph combine repeatedvax_bl repeatedvax_wh, row(2)


***FIGURE 3***

reg vaccinechoice i.condition#i.sciencetrust if race==2
margins condition#sciencetrust 
marginsplot, by(sciencetrust) scheme(plotplain)  recast(scatter) level(84) plotopts(mlabel(_margin) mlabformat(%9.2f) msymbol(D) msize(small) mlabposition(2)) ytitle("Vaccination Intent Decrease/Increase") xtitle("Condition") name(vaccinechoice_bl)

reg vaccinechoice i.condition#i.sciencetrust if race==1
margins condition#sciencetrust 
marginsplot, by(sciencetrust) scheme(plotplain)  recast(scatter) level(84) plotopts(mlabel(_margin) mlabformat(%9.2f) msymbol(D) msize(small) mlabposition(2)) ytitle("Vaccination Intent Decrease/Increase") xtitle("Condition") name(vaccinechoice_wh)

graph combine vaccinechoice_bl vaccinechoice_wh, row(2)


***********************APPENDIX****************************


***Table A1***
sum i.race sciencetrust partyID_dem partyID_rep i.gender kidsunder18 ageN ruralID urbanID essential educ1 educ2 educ3 educ4 educ5 educ6 educ7 income1 income2 income3 income4 income5 income6 income7 income8 income9 income10 income11 income12 evangelic if race==1 | race==2


***Table A2***
iebaltab sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic if race==1 | race==2, grpvar(condition) control(1) save("C:\Users\moceno\Desktop\tableA2")


***Table D1***
reg vaccine i.condition#i.sciencetrust if race==2
reg vaccine i.condition#i.sciencetrust if race==1

***Table D2***
reg repeatedvax i.condition#i.sciencetrust if race==2
reg repeatedvax i.condition#i.sciencetrust if race==1

***Table D3***
reg vaccinechoice i.condition#i.sciencetrust if race==2
reg vaccinechoice i.condition#i.sciencetrust if race==1


***Table E1***
reg vaccine i.condition if race==2
reg vaccine i.condition if race==1

***Table E2***
reg repeatedvax i.condition if race==2
reg repeatedvax i.condition if race==1

***Table E3***
reg vaccinechoice i.condition if race==2
reg vaccinechoice i.condition if race==1


***Table E4***
reg vaccine i.condition##sciencetrust if race==2
reg vaccine i.condition##sciencetrust if race==1

***Table E5***
reg repeatedvax i.condition##sciencetrust if race==2
reg repeatedvax i.condition##sciencetrust if race==1

***Table E6***
reg vaccinechoice i.condition##sciencetrust if race==2
reg vaccinechoice i.condition##sciencetrust if race==1


***TABLE F1***
logit sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic


***Table G1***
reg vaccine i.condition#i.sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic if race==2 
reg vaccine i.condition#i.sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic if race==1 

***Table G2***
reg repeatedvax i.condition#i.sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic if race==2 
reg repeatedvax i.condition#i.sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic if race==1 

***Table G3***
reg vaccinechoice i.condition#i.sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic if race==2 
reg vaccinechoice i.condition#i.sciencetrust partyid gender kidsunder18 ageN rural essential education income_norm01 evangelic if race==1 


***Table G4***
reg vaccine i.condition#i.sciencetrust if race==1 & partyID_rep==1 
reg vaccine i.condition#i.sciencetrust if race==1 & partyID_dem==1

***Table G5***
reg repeatedvax i.condition#i.sciencetrust if race==1 & partyID_rep==1 
reg repeatedvax i.condition#i.sciencetrust if race==1 & partyID_dem==1 

***Table G6***
reg vaccinechoice i.condition#i.sciencetrust if race==1 & partyID_rep==1 
reg vaccinechoice i.condition#i.sciencetrust if race==1 & partyID_dem==1


